/*     */ package com.zimbra.cs.client;
/*     */ 
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class LmcMimePart
/*     */ {
/*     */   private String partName;
/*     */   private String contentType;
/*     */   private String contentTypeName;
/*     */   private String contentDisp;
/*     */   private String contentDispFilename;
/*     */   private String isBody;
/*     */   private String messageID;
/*     */   private String size;
/*     */   private String convID;
/*  35 */   private boolean isBodyBool = false;
/*     */   
/*     */ 
/*     */   private String contentEncoding;
/*     */   
/*     */ 
/*     */   private String content;
/*     */   
/*     */   private String contentDesc;
/*     */   private LmcMimePart[] subParts;
/*     */   
/*  46 */   public void setSubParts(LmcMimePart[] s) { this.subParts = s; }
/*  47 */   public void setConvID(String c) { this.convID = c; }
/*  48 */   public void setSize(String s) { this.size = s; }
/*  49 */   public void setPartName(String m) { this.partName = m; }
/*  50 */   public void setContentType(String c) { this.contentType = c; }
/*  51 */   public void setContentTypeName(String c) { this.contentTypeName = c; }
/*  52 */   public void setContentDisp(String c) { this.contentDisp = c; }
/*  53 */   public void setContentDispFilename(String c) { this.contentDispFilename = c; }
/*  54 */   public void setMessageID(String m) { this.messageID = m; }
/*     */   
/*  56 */   public void setIsBody(String b) { this.isBody = b;
/*  57 */     this.isBodyBool = ((this.isBody != null) && (this.isBody.compareTo("1") == 0));
/*     */   }
/*     */   
/*     */ 
/*  61 */   public void setContentEncoding(String c) { this.contentEncoding = c; }
/*  62 */   public void setContent(String c) { this.content = c; }
/*     */   
/*     */   public void setContentDesc(String c) {
/*  65 */     this.contentDesc = c;
/*     */   }
/*     */   
/*  68 */   public LmcMimePart[] getSubParts() { return this.subParts; }
/*  69 */   public String getSize() { return this.size; }
/*  70 */   public String getPartName() { return this.partName; }
/*  71 */   public String getConvID() { return this.convID; }
/*  72 */   public String getContentType() { return this.contentType; }
/*  73 */   public String getContentTypeName() { return this.contentTypeName; }
/*  74 */   public String getContentDisp() { return this.contentDisp; }
/*  75 */   public String getContentDispFilename() { return this.contentDispFilename; }
/*  76 */   public String getContentDesc() { return this.contentDesc; }
/*  77 */   public String getContentEncoding() { return this.contentEncoding; }
/*  78 */   public String getContent() { return this.content; }
/*  79 */   public String getMessageID() { return this.messageID; }
/*  80 */   public String getIsBody() { return this.isBody; }
/*  81 */   public boolean isBody() { return this.isBodyBool; }
/*     */   
/*     */   public String getMessageBody() {
/*  84 */     return findBodyContent(this);
/*     */   }
/*     */   
/*     */   private static String findBodyContent(LmcMimePart parent) {
/*  88 */     if (parent.isBody())
/*  89 */       return parent.getContent();
/*  90 */     if (parent.subParts != null) {
/*  91 */       for (int i = 0; i < parent.subParts.length; i++) {
/*  92 */         LmcMimePart part = parent.subParts[i];
/*  93 */         String c = findBodyContent(part);
/*  94 */         if (c != null)
/*  95 */           return c;
/*     */       }
/*     */     }
/*  98 */     return null;
/*     */   }
/*     */   
/*     */   public String[] getAttachmentPartNumbers() {
/* 102 */     List parts = new ArrayList();
/* 103 */     findAttachmentParts(this, parts);
/* 104 */     if (parts.size() > 0) {
/* 105 */       String[] array = new String[parts.size()];
/* 106 */       return (String[])parts.toArray(array);
/*     */     }
/* 108 */     return null;
/*     */   }
/*     */   
/*     */   private static void findAttachmentParts(LmcMimePart parent, List parts) {
/* 112 */     if (parent.subParts != null) {
/* 113 */       for (int i = 0; i < parent.subParts.length; i++) {
/* 114 */         findAttachmentParts(parent.subParts[i], parts);
/*     */       }
/*     */     } else {
/* 117 */       String cd = parent.getContentDisp();
/* 118 */       if ((cd != null) && (cd.compareToIgnoreCase("attachment") == 0)) {
/* 119 */         String pn = parent.getPartName();
/* 120 */         if (pn != null) {
/* 121 */           parts.add(pn);
/*     */         }
/*     */       }
/*     */     }
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/client/LmcMimePart.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */